<?php  
namespace Org\Util;

class Mail{
	private $smtpServer="smtp.sina.com";         //smtp服务器地址 163:smtp.163.com  qq:smtp.qq.com  sina:smtp.sina.com
	private $smtpPort=25;                       //smtpd端口号
	private $mailUser="wangzy_smile@sina.com";  //发件人邮箱账号
	private $mailPass="wzy12143210";            //发件人邮箱密码
	private $mailType="TXT";                    //内容文本形式： TXT/HTML
	private $tarMail;                           //目标邮箱账号
	private $subject;                           //邮件主题
	private $content;                           //邮件内
	
	function __construct($tarMail,$subject,$content){
		$this->tarMail=$tarMail;
		$this->subject=$subject;
		$this->content=$content;
	}
	
	function setConfig($smtpServer,$port,$mailUser,$mailPass){
		$this->smtpServer=$smtpServer;
		$this->smtpPort=$port;
		$this->mailUser=$mailUser;
		$this->mailPass=$mailPass;
	}
	
	function setType($mailType){
		$this->mailType=$mailType;
	}
	
	function sendTo($debug=NULL){
		$smtp=new \Org\Util\Smtp($this->smtpServer,$this->smtpPort,true,$this->mailUser,$this->mailPass);
		if(isset($debug)) $smtp->debug=$debug; else $smtp->debug=false;                                        //是否开错误调试
		
		if(@$smtp->sendmail($this->tarMail,$this->mailUser,$this->subject,$this->content,$this->mailType))     //发送邮件
		return true;
		else false;
	}
}
?> 